package com.sec.typhoondatapush.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

/**
 * 定时任务的配置
 *
 * @author zhuwq
 * @version V1.0
 * @date Create in  2018/7/30- 15:11
 */
@Configuration
public class QuartzConfiguration {

    @Bean
    public SchedulerFactoryBean schedulerFactoryBean() {
        SchedulerFactoryBean scheduler = new SchedulerFactoryBean();
        // 用于Quartz集群,启动时更新已存在的Job
//        scheduler.setOverwriteExistingJobs(true);
        // 定时任务开始启动后延迟1秒开始
        scheduler.setStartupDelay(1);
        // scheduler.setAutoStartup(false);  // to not automatically start after startup
        scheduler.setWaitForJobsToCompleteOnShutdown(true);
        return scheduler;
    }

}
